package cn.tedu_two;

import java.io.File;
import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        String z=new Scanner(System.in).nextLine();
        File f=new File(z);
        System.out.println(method(f));
        method2(f);
    }
    private static long method(File f){
        File[] a=f.listFiles();
        long l=0;
        for(File x:a){
            if(x.isFile()){
               l=l+x.length();
            }else if(x.isDirectory()){
                l=l+method(x);
            }
        }
        return l;
    }
    private static void method2(File f){
        File[] a=f.listFiles();
        for(File x:a){
            if(x.isFile()){
                x.delete();
            }else if(x.isDirectory()){
                method2(x);
            }
        }
        f.delete();
    }
}
